<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Java实训课程 - 首页</title>
<!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
<script src="libs/jquery-1.12.1.min.js"></script>
<link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="libs/nv.d3.min.css" rel="stylesheet">
<script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
<script src="libs/handlebars.min.js"></script>
<script src="libs/js.cookie-2.1.0.min.js"></script>
<script src="libs/d3.v3.min.js"></script>
<script src="libs/nv.d3.min.js"></script>
<script src="libs/dateFormat.js"></script>
<script src="libs/jquery.backstretch.min.js"></script>
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="page-header">
				<h2>
					<strong>档案管理</strong>
					<button id="querynull" class="btn btn-primary pull-right">退出</button>
				</h2>
			</div>
		</div>
	</div>
	<div class="container">
		<div class="col-md-8">
			<ul class="nav nav-pills">
				<li class="active"><a href="#">首页</a></li>
				<li><a href="add.html">新加档案</a></li>
				<li><a href="query.html">查询</a></li>
				<li><a href="#">用户：<span id="nickname"></span></a></li>
				<li>
					<div className="input-group">
						<input className="from-control" id="search-box-value"
							placeholder="档案号或身份证号" type="text" /> <span
							className="inputt-group-btu">
							<button id="search" className="btu btu-default"
								onClick={this.submit} type="button">
								<i className="fa fa-search"><span
									class="glyphicon glyphicon-search" aria-hidden="true"></span></i>
							</button>
						</span>
					</div>
				</li>
			</ul>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<hr />
			</div>
		</div>
	</div>

	<div class="container">
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-primary">
					<div class="panel-heading">
						<p>最近浏览的四份档案</p>
					</div>
					<div class="panel-body" id="list1"></div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-primary">
					<div class="panel-heading">
						<p>最近添加的四份档案</p>
					</div>
					<div class="panel-body" id="list2"></div>
				</div>
			</div>
		</div>
	</div>

	<div class="container">
		<div class="row">
			<div class="col-md-6">
				时间查询:<input id="date1" type="date">&nbsp-- <input id="date2"
					type="date">
				<button id="chaxun">查询</button>
			</div>
		</div>
		<div class="row">
			<div class="col-md-6" id="chart">
				<p class="text-center">
					<br />
				<hr />
				<strong>使用统计</strong>
				<svg style="height: 480px; width: 100%"></svg>
				<br />
				</p>
			</div>
			<div class="col-md-6" id="chart1">
				<p class="text-center">
					<br />
				<hr />
				<svg style="height: 480px; width: 100%"></svg>
				<br />
				</p>
			</div>
		</div>
	</div>
	<script type="text/x-handlebars-template" id="template">
    {{#each item}}
    <div class="panel panel-default col-md-3">
      <div class="panel-body">
        <dl>
          <dt>档案号</dt>   <dd>{{archive_id}}</dd>
          <dt>身份证浩</dt>   <dd>{{identity}}</dd>
          <dt>姓名</dt>   <dd>{{name}}</dd>
          <dt>性别</dt><dd>{{gender}}</dd>
          <dt>出生日期</dt><dd>{{birthday}}</dd>
          <dt>预退休日期</dt>   <dd>{{date_retire1}}</dd>
          <dt>实际退休日期</dt>   <dd>{{date_retire2}}</dd>
          <dt>特殊工种</dt>   <dd>{{sp}}</dd>
          <dt>女管理岗位</dt>   <dd>{{fc}}</dd>
          <dt>职称</dt>   <dd>{{title}}</dd>
          <dt>工龄</dt>   <dd>{{seniority}}</dd>
       </dl>
     </div>
   </div>
   {{/each}}
   {{#each item1}}
    <div class="panel panel-default col-md-3">
      <div class="panel-body">
        <dl>
          <dt>档案号</dt>   <dd>{{archive_id}}</dd>
          <dt>身份证浩</dt>   <dd>{{identity}}</dd>
          <dt>姓名</dt>   <dd>{{name}}</dd>
          <dt>性别</dt><dd>{{gender}}</dd>
          <dt>出生日期</dt><dd>{{birthday}}</dd>
          <dt>预退休日期</dt>   <dd>{{date_retire1}}</dd>
          <dt>实际退休日期</dt>   <dd>{{date_retire2}}</dd>
          <dt>特殊工种</dt>   <dd>{{sp}}</dd>
          <dt>女管理岗位</dt>   <dd>{{fc}}</dd>
          <dt>职称</dt>   <dd>{{title}}</dd>
          <dt>工龄</dt>   <dd>{{seniority}}</dd>
       </dl>
     </div>
   </div>
   {{/each}}
 </script>

	<script type="text/javascript">
		if (!Cookies.get("users")) {
			window.location.href = 'login.html';
		}
		$(function() {
			$('#search').click(function() {
				$.post('queryone.action', {
					search : $('#search-box-value').val(),
				}, function(res, status) {
					if ("ERR1" == res) {
						alert('未查到档案')
					} else if ("ERR2" == res) {
						alert('请输入正确档案号')
					} else {
						window.location.href = 'queryone.html?id=' + res;
					}
				})
			})
		})
	</script>

</body>

<script type="text/javascript">
	$(function() {
		$.getJSON('querynick.action', function(res) {
			$('#nickname').text(res.nick);
		})

		$.getJSON('queryliu.action', function(res) {
			//console.log(res); 
			var data = {
				'item' : res
			};
			var t = Handlebars.compile($('#template').html());
			$('#list1').html(t(data));
		})

		$.getJSON('queryadd.action', function(res) {
			//console.log(res);
			var data = {
				'item1' : res
			};
			var t = Handlebars.compile($('#template').html());
			$('#list2').html(t(data));
		})

		$('#chaxun').click(
				function() {
					var d2 = new Date();
					$('#date2').val(d2.format('yyyy-MM-dd'));
					var d1 = new Date();
					$('#date1').val(d1.format('yyyy-MM-01'));
					$.post('querycount.action', {
						date1 : $('#date1').val(),
						date2 : $('#date2').val(),
					}, function(res, status) {
						nv.addGraph(function() {
							var chart = nv.models.pieChart().x(function(d) {
								return d.nick
							}).y(function(d) {
								return d.counter
							}).showLabels(true).labelType('percent');
							d3.select("#chart svg").datum(res).transition()
									.duration(350).call(chart);
							return chart;
						})
					})
				})

		$('#querynull').click(function() {
			$.post('querynull.action', {}, function(res, status) {
				if ('OK' == res) {
					alert('确定退出本次登陆');
				}
				window.location.href = "login.html";
			});
		});

	})
</script>
<script type="text/javascript">
	$(function() {
		$.backstretch("image/1.jpg")
	})
</script>
</html>
